﻿document.writeln("<script src='\/wap/qijixs\/ajax.js'><\/script>");

function show_bookcase(){
	info = document.getElementById("info");
	if(info.style.display == "block"){
		info.style.display = "none";	
	}
	else{
		info.style.display = "block";	
	}
}

function show_search(){
	
	var type = document.getElementById("type");
	var searchType = document.getElementById("searchType");
	if(type.innerHTML == "书名"){
		type.innerHTML = "作者";
		searchType.value = "author";
		//alert(searchType.value);
	}
	else{
		type.innerHTML = "书名";
		searchType.value = "articlename";
	}
}

//全部章节并分页
function allchapter(aid,page){
	var chapter_load = document.getElementById("chapter_load");
	
	chapter_load.style.display = "block";
	
	var pagetips = document.getElementById("pagetips");
	if(pagetips){pagetips.style.display = "none";}
	
	
	if(page == "gopage"){
		var pagenum = document.getElementById("pagenum");
		if(pagenum.value != ""){
			if(!isNaN(pagenum.value)){
				doAjax("/modules/article/wapallchapter.php", "aid=" + aid + "&page=" + pagenum.value, "allchapter2", "GET", 0);				
			}
			else{
				chapter_load.style.display = "none";
				pagetips.style.display = "block";
			}
		}
		else{
			chapter_load.style.display = "none";
			pagetips.style.display = "block";
				
		}
	}
	else{
		doAjax("/modules/article/wapallchapter.php", "aid=" + aid + "&page=" + page, "allchapter2", "GET", 0);	
	}	
}
//倒序
function allchapter_t(aid,page){
	var chapter_load = document.getElementById("chapter_load_3");
	
	chapter_load.style.display = "block";
	
	var pagetips = document.getElementById("pagetips_3");
	if(pagetips){pagetips.style.display = "none";}
	
	
	if(page == "gopage"){
		var pagenum = document.getElementById("pagenum_3");
		if(pagenum.value != ""){
			if(!isNaN(pagenum.value)){
				doAjax("/modules/article/wapallchapter_2.php", "aid=" + aid + "&page=" + pagenum.value, "allchapter_t2", "GET", 0);				
			}
			else{
				chapter_load.style.display = "none";
				pagetips.style.display = "block";
			}
		}
		else{
			chapter_load.style.display = "none";
			pagetips.style.display = "block";
				
		}
	}
	else{
		doAjax("/modules/article/wapallchapter_2.php", "aid=" + aid + "&page=" + page, "allchapter_t2", "GET", 0);	
	}	
}

function allchapter2(t){
	document.getElementById("chapter_load").style.display = "none";
	document.getElementById("all_chapter").innerHTML = t ;
}
function allchapter_t2(t){
	document.getElementById("chapter_load_3").style.display = "none";
	document.getElementById("all_chapter_3").innerHTML = t ;
}

var checkbg = "#A7A7A7";
//内容页用户设置
function nr_setbg(intype){
	var huyandiv = document.getElementById("huyandiv");
	var light = document.getElementById("lightdiv");
	if(intype == "huyan"){
		if(huyandiv.style.backgroundColor == ""){
			set("light","huyan");
			document.cookie="light=huyan;path=/"; 
		}
		else{
			set("light","no");
			document.cookie="light=no;path=/"; 
		}
	}
	if(intype == "light"){
		if(light.innerHTML == "关灯"){
			set("light","yes");
			document.cookie="light=yes;path=/"; 
		}
		else{
			set("light","no");
			document.cookie="light=no;path=/"; 
		}
	}
	if(intype == "big"){
		set("font","big");
		document.cookie="font=big;path=/"; 
	}
	if(intype == "middle"){
		set("font","middle");
		document.cookie="font=middle;path=/"; 
	}
	if(intype == "small"){
		set("font","small");
		document.cookie="font=small;path=/"; 
	}		
}

//内容页读取设置
function getset(){ 
	var strCookie=document.cookie; 
	var arrCookie=strCookie.split("; ");  
	var light;
	var font;

	for(var i=0;i<arrCookie.length;i++){ 
		var arr=arrCookie[i].split("="); 
		if("light"==arr[0]){ 
			light=arr[1]; 
			break; 
		} 
	} 
	for(var i=0;i<arrCookie.length;i++){ 
		var arr=arrCookie[i].split("="); 
		if("font"==arr[0]){ 
			font=arr[1]; 
			break; 
		} 
	} 
	
	//light
	if(light == "yes"){
		set("light","yes");
	}
	else if(light == "no"){
		set("light","no");
	}
	else if(light == "huyan"){
		set("light","huyan");
	}
	//font
	if(font == "big"){
		set("font","big");
	}
	else if(font == "middle"){
		set("font","middle");
	}
	else if(font == "small"){
		set("font","small");
	}
	else{
		set("","");	
	}
}

//内容页应用设置
function set(intype,p){
	var nr_body = document.getElementById("nr_body");//页面body
	var huyandiv = document.getElementById("huyandiv");//护眼div
	var lightdiv = document.getElementById("lightdiv");//灯光div
	var fontfont = document.getElementById("fontfont");//字体div
	var fontbig = document.getElementById("fontbig");//大字体div
	var fontmiddle = document.getElementById("fontmiddle");//中字体div
	var fontsmall = document.getElementById("fontsmall");//小字体div
	var nr1 =  document.getElementById("nr1");//内容div
	var nr_title =  document.getElementById("nr_title");//文章标题
	var nr_title =  document.getElementById("nr_title");//文章标题
	//var shuqian_2 = document.getElementById("shuqian_2");//书签链接
	
	var pt_prev =  document.getElementById("pt_prev");
	var pt_mulu =  document.getElementById("pt_mulu");
	var pt_next =  document.getElementById("pt_next");
	var pb_prev =  document.getElementById("pb_prev");
	var pb_mulu =  document.getElementById("pb_mulu");
	var pb_next =  document.getElementById("pb_next");
	
	//初始化
	//document.getElementsByName("page_nr")[1].style.color = "#000";
	
	//灯光
	if(intype == "light"){
		if(p == "yes"){	
			//关灯
			lightdiv.innerHTML = "开灯";
			nr_body.style.backgroundColor = "#000";
			huyandiv.style.backgroundColor = "";
			nr_title.style.color = "#ccc";
			nr1.style.color = "#999";
			pt_prev.style.cssText = "background-color:#222;color:#0065B5;border:1px solid #0065B5";
			pt_mulu.style.cssText = "background-color:#222;color:#0065B5;border:1px solid #0065B5";
			pt_next.style.cssText = "background-color:#222;color:#0065B5;border:1px solid #0065B5";
			pb_prev.style.cssText = "background-color:#222;color:#0065B5;border:1px solid #0065B5";
			pb_mulu.style.cssText = "background-color:#222;color:#0065B5;border:1px solid #0065B5";
			pb_next.style.cssText = "background-color:#222;color:#0065B5;border:1px solid #0065B5";
			//shuqian_2.style.color = "#999";
		}
		else if(p == "no"){
			//开灯
			lightdiv.innerHTML = "关灯";
			nr_body.style.backgroundColor = "#fff";
			nr1.style.color = "#000";
			nr_title.style.color = "#000";
			huyandiv.style.backgroundColor = "";
			pt_prev.style.cssText = "";
			pt_mulu.style.cssText = "";
			pt_next.style.cssText = "";
			pb_prev.style.cssText = "";
			pb_mulu.style.cssText = "";
			pb_next.style.cssText = "";
			//shuqian_2.style.color = "#000";
		}
		else if(p == "huyan"){
			//护眼
			lightdiv.innerHTML = "关灯";
			huyandiv.style.backgroundColor = checkbg;
			nr_body.style.backgroundColor = "#005716";
			nr1.style.color = "#000";
			pt_prev.style.cssText = "background-color:#0E7A18;color:#000;border:1px solid #0065B5";
			pt_mulu.style.cssText = "background-color:#0E7A18;color:#000;border:1px solid #0065B5";
			pt_next.style.cssText = "background-color:#0E7A18;color:#000;border:1px solid #0065B5";
			pb_prev.style.cssText = "background-color:#0E7A18;color:#000;border:1px solid #0065B5";
			pb_mulu.style.cssText = "background-color:#0E7A18;color:#000;border:1px solid #0065B5";
			pb_next.style.cssText = "background-color:#0E7A18;color:#000;border:1px solid #0065B5";
			//shuqian_2.style.color = "#000";
		}
	}
	//字体
	if(intype == "font"){
		//alert(p);
		fontbig.style.backgroundColor = "";
		fontmiddle.style.backgroundColor = "";
		fontsmall.style.backgroundColor = "";
		if(p == "big"){
			fontbig.style.backgroundColor = checkbg;
			nr1.style.fontSize = "25px";
		}
		if(p == "middle"){
			fontmiddle.style.backgroundColor = checkbg;
			nr1.style.fontSize = "15px";
		}
		if(p == "small"){
			fontsmall.style.backgroundColor = checkbg;
			nr1.style.fontSize = "12px";
		}
	}
}

function daoxu(){
	if(document.getElementById("dx").innerHTML == "倒序显示"){
		document.getElementById("dx").innerHTML = "正序显示"
		document.getElementById("chapter_outsite_3").style.display = "block";
		document.getElementById("chapter_outsite").style.display = "none";
	}
	else{
		document.getElementById("dx").innerHTML = "倒序显示"
		document.getElementById("chapter_outsite").style.display = "block";
		document.getElementById("chapter_outsite_3").style.display = "none";
	}
}

//广告开始
function qijixs_top(){//顶部广告
	document.writeln("<div style='margin-top:10px;text-align:center'></div>");
}

function qijixs_middle(){//中间广告
	document.writeln("<div style='margin-top:10px;text-align:center'></div>");
}

function qijixs_bottom(){//底端广告
	document.writeln("<div style='margin-top:10px;text-align:center'></div>");
}
